package com.hnkywl.sts.action.cwgl.kmys;

import com.hnkywl.sts.entity.organ.Khh;
import com.hnkywl.sts.entity.sys.Yg;
import com.hnkywl.sts.service.organ.KhhService;
import com.hnkywl.sts.service.sys.YgService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-5-16
 * Time: 下午4:55
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/cwgl/kmys/cwxtzhys")
public class CwxtzhysAction extends SimpleActionSupport{
    //员工Service
    private YgService ygService;
    //员工
    private Yg yg;
    //员工姓名
    private String xm;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows;
    //主管公司Id
    private Long nbgsId;

    @Action("cwxtzhysList")
    public void findKmdmList(){
        renderJson(ygService.findAllYgByXmGs(xm, nbgsId, page, rows));
    }

    @Action("save")
    public void save(){
        try{
            ygService.saveYgJiuqiConform(yg);
            renderJson("{\"statusCode\":200}");
        }catch (Exception  e) {
            e.printStackTrace();
            renderJson("{\"statusCode\":300,\"message\":\""+e.getMessage()+"\"}");
        }
    }



    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public String getXm() {
        return xm;
    }

    public void setXm(String xm) {
        this.xm = xm;
    }

    public Yg getYg() {
        return yg;
    }

    public void setYg(Yg yg) {
        this.yg = yg;
    }

    public Long getNbgsId() {
        return nbgsId;
    }

    public void setNbgsId(Long nbgsId) {
        this.nbgsId = nbgsId;
    }

    @Autowired
    public void setYgService(YgService ygService) {
        this.ygService = ygService;
    }
}
